#database.py
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

# 数据库访问地址
SQLALCHEMY_DATABASE_URL = "mysql+pymysql://root:ye333222@192.168.2.88:3306/vtest?charset=utf8"

# 启动引擎
engine = create_engine(
    SQLALCHEMY_DATABASE_URL,
    pool_recycle=3600
)

# 启动会话
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

# 数据模型的基类
Base = declarative_base()